reservations-eapi icon

reservations-eapi

(0 reviews)

Availability - Basic Usage

This page provides an example of the simplest type of availability searching. It is intended to be a starter example for people unfamiliar with availability and/or the reservation interface to understand the basic concepts before moving on to more complex, real-world, examples.

Below is an example availability request for one product (SVS, 00000) for one adult (000) passenger who is looking to travel on 9th March between Chelmsford (6836) and Manchester Piccadilly (2968). This journey has 3 legs (Chelmsford to London Liverpool Street, London Liverpool Street to London Euston and London Euston (EUS) to Manchester Piccadilly (MAN)) but only the final leg on an Avanti West Coast train (VT707000) allows reservations to be made.

Request:

{
   "salesFlowType": "SALES",
   "journeys": [
      {
         "id": "journey_1",
         "direction": "outbound",
         "journeyConditions": {
            "journeyOD": {
               "journeyOrigin": "6836",
               "journeyDestination": "2968"
            }
         },
         "legs": [
            {
               "id": "segment_1",
               "boardLocation": "EUS",
               "alightLocation": "MAN",
               "rsid": "VT123400",
               "serviceOriginDate": "2021-03-09"
            }
         ],
         "bundles": [
            {
               "id": "bundle_1",
               "products": [
                  {
                     "ticketTypeCode": "SVS",
                     "routeCode": "00000"
                  }
               ]
            }
         ]
      }
   ],
   "passengers": [
      {
         "id": "passenger_1",
         "statusCode": "000"
      }
   ]
}

Response, Example 1 - product is available:

The below response to this request indicates that this product is available for this passenger (FULL_AVAILABILITY) on the requested service. In addition to confirming availability it also provides information about the requested service and product:

Information:

  • Inventory Class associated to the product (2C)
  • Departure timestamp for the board location on the reservable leg (2021-03-09T10:20:00+00:00)
  • Arrival timestamp for the alight location on the reservable leg (2021-03-09T12:28:00+00:00)
  • Carrier code for the reservable leg (VT)

The response also includes data which the consumer will need if they move forward to make a booking:

  • Tariff code associated to the product for this service (2O_SVS)
  • Service identifier, a unique string used to identify a service when executing a booking (0:R|VT123400|TRAIN|2021-03-09)
{
   "salesFlowType": "SALES",
   "journeys": [
      {
         "journeyConditions": {
            "journeyOD": {
               "journeyDestination": "2968",
               "journeyOrigin": "6836"
            }
         },
         "bundles": [
            {
               "bundleOutcome": "FULL_AVAILABILITY",
               "products": [
                  {
                     "ticketTypeCode": "SVS",
                     "items": [
                        {
                           "inventoryClass": "2C",
                           "passengerIds": [
                              "passenger_1"
                           ],
                           "legId": "segment_1",
                           "tariffCode": "2O_SVS"
                        }
                     ],
                     "routeCode": "00000"
                  }
               ],
               "id": "bundle_1"
            }
         ],
         "direction": "outbound",
         "id": "journey_1",
         "legs": [
            {
               "arrivalDateTime": "2021-03-09T12:28:00+00:00",
               "departureDateTime": "2021-03-09T10:20:00+00:00",
               "alightLocation": "MAN",
               "boardLocation": "EUS",
               "id": "segment_1",
               "serviceOriginDate": "2021-03-09",
               "serviceIdentifier": "0:R|VT123400|TRAIN|2021-03-09",
               "rsid": "VT707000",
               "carrierCode": "VT"
            }
         ]
      }
   ],
   "passengers": [
      {
         "id": "passenger_1",
         "statusCode": "000"
      }
   ]
}

Response, Example 2 - product is NOT available:

The below example shows how the response would look if the requested product isn't available for booking on the requested service.

  • If the product's terms and conditions include mandatory reservation this response means the ticket cannot be sold for travel on this service.
  • If the product's terms and conditions are for optional reservations then it is still possible to sell this ticket for this service but a seat cannot be booked
{
   "salesFlowType": "SALES",
   "journeys": [
      {
         "journeyConditions": {
            "journeyOD": {
               "journeyDestination": "2968",
               "journeyOrigin": "6836"
            }
         },
         "bundles": [
            {
               "bundleOutcome": "NO_AVAILABILITY",
               "id": "bundle_1"
            }
         ],
         "direction": "outbound",
         "id": "journey_1",
         "legs": [
            {
               "arrivalDateTime": "2021-03-09T12:28:00+00:00",
               "departureDateTime": "2021-03-09T10:20:00+00:00",
               "alightLocation": "MAN",
               "boardLocation": "EUS",
               "id": "segment_1",
               "serviceOriginDate": "2021-03-09",
               "serviceIdentifier": "0:R|VT123400|TRAIN|2021-03-09",
               "rsid": "VT707000",
               "carrierCode": "VT"
            }
         ]
      }
   ],
   "passengers": [
      {
         "id": "passenger_1",
         "statusCode": "000"
      }
   ]
}

Response, Example 3 - leg availability:

The availability API supports an optional request parameter: includeLegAvailability. If this parameter is set to true then responses will include a leg availability field if the journeys has 2 or more legs and the bundle outcome does not equal full or partial availability. This additional field tells consumers whether any of the legs of a multi-leg journey are available for a given product even if the overall journey is not.

The first example shows how the response would look if the request does not include this parameter for a two leg journey with a fare which is available on leg 1 but not available on leg 2, whereas the second example shows how the response would look if the parameter is included and set to "true"

  1. /v2/availability
{
    "passengers": [
        {
            "id": "passenger_1",
            "statusCode": "000"
        }
    ],
    "journeys": [
        {
            "journeyConditions": {
                "journeyOD": {
                    "journeyDestination": "3333",
                    "journeyOrigin": "3087"
                }
            },
            "legs": [
                {
                    "alightLocation": "KGX",
                    "rsid": "GR108000",
                    "departureDateTime": "2023-12-18T06:40:00Z",
                    "id": "segment_1",
                    "boardLocation": "LDS",
                    "serviceOriginDate": "2023-12-18",
                    "arrivalDateTime": "2023-12-18T08:49:00Z",
                    "serviceIdentifier": "0:R|GR108000|TRAIN|2023-12-18",
                    "carrierCode": "GR"
                },
                {
                    "alightLocation": "EDB",
                    "rsid": "GR616000",
                    "departureDateTime": "2023-12-18T09:00:00Z",
                    "id": "segment_2",
                    "boardLocation": "KGX",
                    "serviceOriginDate": "2023-12-18",
                    "arrivalDateTime": "2023-12-18T13:21:00Z",
                    "serviceIdentifier": "0:R|GR616000|TRAIN|2023-12-18",
                    "carrierCode": "GR"
                }
            ],
            "bundles": [
                {
                    "bundleOutcome": "NO_AVAILABILITY",
                    "id": "bundle_3"
                }
            ],
            "id": "journey_1",
            "direction": "outbound"
        }
    ],
    "salesFlowType": "SALES"
  1. /v2/availability?includeLegAvailability=true
{
    "passengers": [
        {
            "id": "passenger_1",
            "statusCode": "000"
        }
    ],
    "journeys": [
        {
            "journeyConditions": {
                "journeyOD": {
                    "journeyDestination": "3333",
                    "journeyOrigin": "3087"
                }
            },
            "legs": [
                {
                    "alightLocation": "KGX",
                    "rsid": "GR108000",
                    "departureDateTime": "2023-12-18T06:40:00Z",
                    "id": "segment_1",
                    "boardLocation": "LDS",
                    "serviceOriginDate": "2023-12-18",
                    "arrivalDateTime": "2023-12-18T08:49:00Z",
                    "serviceIdentifier": "0:R|GR108000|TRAIN|2023-12-18",
                    "carrierCode": "GR"
                },
                {
                    "alightLocation": "EDB",
                    "rsid": "GR616000",
                    "departureDateTime": "2023-12-18T09:00:00Z",
                    "id": "segment_2",
                    "boardLocation": "KGX",
                    "serviceOriginDate": "2023-12-18",
                    "arrivalDateTime": "2023-12-18T13:21:00Z",
                    "serviceIdentifier": "0:R|GR616000|TRAIN|2023-12-18",
                    "carrierCode": "GR"
                }
            ],
            "bundles": [
                {
                    "bundleOutcome": "NO_AVAILABILITY",
                    "id": "bundle_3",
                    "products": [
                        {
                            "routeCode": "00000",
                            "ticketTypeCode": "SOR",
                            "items": [
                                {
                                    "tariffCode": "SOR",
                                    "inventoryClass": "2S",
                                    "legId": "segment_1",
                                    "legAvailability": "FULL_AVAILABILITY",
                                    "passengerIds": [
                                        "passenger_1"
                                    ]
                                },
                                {
                                    "legId": "segment_2",
                                    "legAvailability": "NO_AVAILABILITY"
                                }
                            ]
                        }
                    ]
                }
            ],
            "id": "journey_1",
            "direction": "outbound"
        }
    ],
    "salesFlowType": "SALES"
}

Last update: 02-Aug-2024 15.07: ASSIST API Documentation Maintenance: 'reservations-eapi', Version 'v2', Page 'Availability - Basic Usage', Revision 'A'.

To request updates to this text please contact Neil Barkham.


Reviews